package com.springboot.cloud.goods.rest;

import com.springboot.cloud.goods.entity.Goods;
import com.springboot.cloud.goods.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author godyao
 * @date 2022/3/26
 */
@RestController
public class GoodsController {
    @Autowired
    private IGoodsService goodsService;

    @GetMapping("/goods/{id}")
    public Goods findGoodsById(@PathVariable Long id) {
        return goodsService.findGoodsById(id).orElse(new Goods());
    }
}
